package xyz.lisys.boot.util;

import lombok.val;

import java.util.HashMap;
import java.util.Map;

public class ResponseUtil {

    public static Map<String, Object> ok(Object data) {
        return msg(200, "ok", data);
    }

    public static Map<String, Object> error(Object data) {
        return msg(400, "error", data);
    }

    public static Map<String, Object> msg(Integer code, String msg, Object data) {
        val map = new HashMap<String, Object>();
        map.put("code", code);
        map.put("msg", msg);
        map.put("data", data);
        return map;
    }
}
